﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:BrokenHouse.Windows.Parts.Wizard"
                    xmlns:input="clr-namespace:BrokenHouse.Windows.Parts.Wizard.Input"
                    xmlns:controls="clr-namespace:BrokenHouse.Windows.Controls"
                    xmlns:transitions="clr-namespace:BrokenHouse.Windows.Parts.Transition"
                    xmlns:windows="clr-namespace:BrokenHouse.Windows"
                    xmlns:diag="clr-namespace:System.Diagnostics;assembly=WindowsBase"
                    xmlns:resources="clr-namespace:BrokenHouse.Resources"
                    xmlns:primitives="clr-namespace:BrokenHouse.Windows.Parts.Transition.Primitives">

    <Style x:Key="{x:Static local:WizardElements.AeroWizardBackButtonStyleKey}">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Grid Background="#00FFFFFF" Width="28" Height="28"  FlowDirection="LeftToRight">
                        <Ellipse StrokeThickness="2" Name="Outline" Grid.Column="0">
                            <Ellipse.Stroke>
                                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                    <LinearGradientBrush.GradientStops>
                                        <GradientStop Color="#30000000" Offset="0" />
                                        <GradientStop Color="#20000000" Offset="0.2" />
                                        <GradientStop Color="#00000000" Offset="0.5" />
                                        <GradientStop Color="#00ffffff" Offset="0.5" />
                                        <GradientStop Color="#20ffffff" Offset="0.8" />
                                        <GradientStop Color="#30ffffff" Offset="1.0" />
                                    </LinearGradientBrush.GradientStops>
                                </LinearGradientBrush>
                            </Ellipse.Stroke>
                        </Ellipse>
                        <Ellipse StrokeThickness="1" Name="Circle" Grid.Column="0" Margin="2">
                            <Ellipse.Fill>
                                <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                    <LinearGradientBrush.GradientStops>
                                        <GradientStop Color="#FFFFFFFF" Offset="0" />
                                        <GradientStop Color="#FFCCD4E9" Offset="0.1" />
                                        <GradientStop Color="#FF4881D2" Offset="0.47" />
                                        <GradientStop Color="#FF001A5A" Offset="0.47" />
                                        <GradientStop Color="#FF007BD6" Offset="0.7" />
                                        <GradientStop Color="#FF54DAFF" Offset="0.85" />
                                        <GradientStop Color="#FF86FFFF" Offset="0.95" />
                                        <GradientStop Color="#FFFFFFFF" Offset="1" />
                                    </LinearGradientBrush.GradientStops>
                                </LinearGradientBrush>
                            </Ellipse.Fill>
                            <Ellipse.Stroke>
                                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                    <LinearGradientBrush.GradientStops>
                                        <GradientStop Color="#FF6C90C4" Offset="0" />
                                        <GradientStop Color="#FF315BB4" Offset="0.5" />
                                        <GradientStop Color="#FF002091" Offset="0.5" />
                                        <GradientStop Color="#FF08377C" Offset="1" />
                                    </LinearGradientBrush.GradientStops>
                                </LinearGradientBrush>
                            </Ellipse.Stroke>
                        </Ellipse>
                        <Path Margin="2" Data="M0.37,7.69L5.74,14.2A1.5,1.5,0,1,0,10.26,12.27L8.42,10.42 14.9,10.39A1.5,1.5,0,1,0,14.92,5.87L8.44,5.9 10.31,4.03A1.5,1.5,0,1,0,5.79,1.77z" StrokeThickness="0.75" Name="Arrow" HorizontalAlignment="Center" VerticalAlignment="Center" RenderTransformOrigin="0.5,0" Grid.Column="0">
                            <Path.Fill>
                                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                    <LinearGradientBrush.GradientStops>
                                        <GradientStop Color="#FFFFFFFF" Offset="0.5" />
                                        <GradientStop Color="#FFEEEEEE" Offset="0.5" />
                                        <GradientStop Color="#FFB0B0B0" Offset="1" />
                                    </LinearGradientBrush.GradientStops>
                                </LinearGradientBrush>
                            </Path.Fill>
                            <Path.Stroke>
                                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                    <LinearGradientBrush.GradientStops>
                                        <GradientStop Color="#FF8AB1FB" Offset="0" />
                                        <GradientStop Color="#FF002874" Offset="1" />
                                    </LinearGradientBrush.GradientStops>
                                </LinearGradientBrush>
                            </Path.Stroke>
                        </Path>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="UIElement.IsEnabled" Value="false">
                            <Setter Property="Shape.Fill" TargetName="Circle">
                                <Setter.Value>
                                    <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                        <LinearGradientBrush.GradientStops>
                                            <GradientStop Color="#80ffffff" Offset="0" />
                                            <GradientStop Color="#40ffffff" Offset="0.5" />
                                            <GradientStop Color="#10000000" Offset="0.5" />
                                            <GradientStop Color="#0B000000" Offset="1" />
                                        </LinearGradientBrush.GradientStops>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="Shape.Stroke" TargetName="Circle">
                                <Setter.Value>
                                    <SolidColorBrush>#40000000</SolidColorBrush>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="Shape.Stroke" TargetName="Arrow">
                                <Setter.Value>
                                    <SolidColorBrush>#30000000</SolidColorBrush>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="Shape.Fill" TargetName="Arrow">
                                <Setter.Value>
                                    <SolidColorBrush>#B0FFFFFF</SolidColorBrush>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="UIElement.IsMouseOver" Value="true">
                            <Setter Property="Shape.Fill" TargetName="Circle">
                                <Setter.Value>
                                    <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                        <LinearGradientBrush.GradientStops>
                                            <GradientStop Color="#FFFFFFFF" Offset="0" />
                                            <GradientStop Color="#FFDFEDF9" Offset="0.1" />
                                            <GradientStop Color="#FF3086E1" Offset="0.47" />
                                            <GradientStop Color="#FF003B91" Offset="0.47" />
                                            <GradientStop Color="#FF1793EF" Offset="0.7" />
                                            <GradientStop Color="#FF5AD4FF" Offset="0.85" />
                                            <GradientStop Color="#FFBDFFFF" Offset="0.95" />
                                            <GradientStop Color="#FFFFFFFF" Offset="1" />
                                        </LinearGradientBrush.GradientStops>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="ButtonBase.IsPressed" Value="true">
                            <Setter Property="Shape.Fill" TargetName="Circle">
                                <Setter.Value>
                                    <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                        <LinearGradientBrush.GradientStops>
                                            <GradientStop Color="#FFC0D2F5" Offset="0" />
                                            <GradientStop Color="#FF5E7A9C" Offset="0.47" />
                                            <GradientStop Color="#FF00062D" Offset="0.47" />
                                            <GradientStop Color="#FF005F9F" Offset="0.7" />
                                            <GradientStop Color="#FF1FA4E2" Offset="0.85" />
                                            <GradientStop Color="#FF61DAFF" Offset="0.95" />
                                            <GradientStop Color="#FF48CFFF" Offset="1" />
                                        </LinearGradientBrush.GradientStops>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <!-- Content Wizard Page Background -->
    <SolidColorBrush x:Key="{x:Static local:WizardElements.AeroWizardClassicPageBackgroundKey}"
                     Color="{DynamicResource {x:Static SystemColors.ControlColorKey}}"/>

    <!-- Button bar background Background -->
    <SolidColorBrush x:Key="{x:Static local:WizardElements.AeroWizardButtonBarBackgroundKey}"
                     Color="{DynamicResource {x:Static SystemColors.ControlColorKey}}"/>

    <!-- Separator brush -->
    <SolidColorBrush x:Key="{x:Static local:WizardElements.AeroWizardPageBorderKey}"
                     Color="{DynamicResource {x:Static SystemColors.ControlDarkColorKey}}"/>

    <!-- Error border -->
    <SolidColorBrush x:Key="{x:Static local:WizardElements.AeroWizardErrorBorderKey}"
                     Color="{DynamicResource {x:Static SystemColors.ControlColorKey}}"/>
    
    <!-- Error background brush -->
    <SolidColorBrush x:Key="{x:Static local:WizardElements.AeroWizardErrorBackgroundKey}"
                     Color="{DynamicResource {x:Static SystemColors.InfoColorKey}}"/>
    
    <!-- Error foreground brush -->
    <SolidColorBrush x:Key="{x:Static local:WizardElements.AeroWizardErrorForegroundKey}"
                     Color="{DynamicResource {x:Static SystemColors.InfoTextColorKey}}"/>


    <Style x:Key="{x:Static local:WizardElements.AeroWizardStyleKey}" TargetType="{x:Type local:AeroWizardControl}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:AeroWizardControl}">
                    <DockPanel x:Name="PART_RootLayout"  Background="{DynamicResource {x:Static local:WizardElements.AeroWizardButtonBarBackgroundKey}}">
                        <DockPanel Margin="2,3,0,0" DockPanel.Dock="Top">
                            <Grid x:Name="PART_TopButtonPanel" DockPanel.Dock="Left">
                                <Button Command="input:WizardCommands.Back"
                                        ToolTip="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BackButtonState.Label}"
                                        Margin="0,0,3,3"
                                        Style="{DynamicResource {x:Static local:WizardElements.AeroWizardBackButtonStyleKey}}"/>
                            </Grid>
                            <Image x:Name="PART_GlassIcon" Margin="3,0,3,0" Width="16" Height="16" VerticalAlignment="Center"
                                   DockPanel.Dock="Left"
                                   Source="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Icon}"/>
                            <TextBlock x:Name="PART_GlassText" Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Title}"
                                       Margin="3,0,3,0" FontWeight="Bold"
                                       VerticalAlignment="Center"/>
                        
                        </DockPanel>
 
                        <!--- This is the button bar at the bottom of the control -->
                        <StackPanel x:Name="PART_BottomButtonPanel"  Background="{DynamicResource {x:Static local:WizardElements.AeroWizardButtonBarBackgroundKey}}" 
                                    HorizontalAlignment="Stretch" DockPanel.Dock="Bottom">
                             <StackPanel Orientation="Horizontal" MinHeight="22" 
                                        HorizontalAlignment="Right" 
                                        Margin="5"
                                        KeyboardNavigation.TabNavigation="Local">
                                <Button Command="input:WizardCommands.Next"
                                        Width="64" Margin="4" MinHeight="22"  
                                        Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=NextButtonState.Label}"
                                        IsDefault="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=NextButtonState.IsDefault}"
                                        Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=NextButtonState.Visibility}"/>
                                <Button Command="input:WizardCommands.Finish"
                                        Width="64" Margin="4" MinHeight="22"
                                        Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=FinishButtonState.Label}"
                                        IsDefault="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=FinishButtonState.IsDefault}"
                                        Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=FinishButtonState.Visibility}"/>
                                <Button Command="input:WizardCommands.Cancel"
                                        Width="64" Margin="4" MinHeight="22"
                                        Content="{x:Static resources:Strings.WizardControl_Cancel}"
                                        IsCancel="True"/>
                            </StackPanel>
                        </StackPanel>



                        <Grid>

                            <!-- The actual content on the wizard control - the currently selected page -->
                            <Border BorderBrush="{DynamicResource {x:Static local:WizardElements.AeroWizardPageBorderKey}}" 
                                    Background="{DynamicResource {x:Static local:WizardElements.AeroWizardClassicPageBackgroundKey}}" 
                                    BorderThickness="1">
                                <primitives:TransitionPresenter x:Name="PART_PageHost" Margin="0" FlowDirection="LeftToRight"
                                                                  TransitionEffect="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TransitionEffect}"
                                                                  VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"/>
                            </Border>

                            <!-- This is the optional error section. If an error occurs we will place
                                 the error here. We also may want to animate it. -->
                            <controls:ErrorInfo x:Name="PART_ErrorPanel" 
                                                HorizontalAlignment="Stretch" VerticalAlignment="Bottom" 
                                                Background="{DynamicResource {x:Static local:WizardElements.AeroWizardErrorBackgroundKey}}"
                                                DockPanel.Dock="Bottom" Margin="2"
                                                BorderThickness="1" BorderBrush="{DynamicResource {x:Static local:WizardElements.AeroWizardErrorBorderKey}}"
                                                Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=LastError}"
                                                Opacity="0"
                                                CloseCommand="input:WizardCommands.CloseLastError"/>

                        </Grid>
                    </DockPanel>

                    <ControlTemplate.Triggers>

                        <!-- If the message is blank we do not want to show the error message-->
                        <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=LastErrorMessage, Mode=OneWay}" Value="{x:Null}">
                            <Setter TargetName="PART_ErrorPanel" Property="Visibility" Value="Collapsed"/>
                        </DataTrigger>

                        <!-- Use to set the icon from the window if an icon is not present in the wizard -->
                        <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Icon}" Value="{x:Null}">
                            <Setter TargetName="PART_GlassIcon" Property="Source" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type windows:AeroWindow}}, Path=Icon}"/>
                        </DataTrigger>
                        
                        <!-- Use to set the title from the window if an title is not present in the wizard -->
                        <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Title}" Value="{x:Null}">
                            <Setter TargetName="PART_GlassText" Property="Text" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=Title}"/>
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type windows:AeroWindow}" BasedOn="{StaticResource {x:Type Window}}">
        
    </Style>

        <!-- Content Wizard Page Style -->
    <Style TargetType="{x:Type local:AeroWizardPage}" x:Key="{x:Static local:WizardElements.AeroWizardPageStyleKey}">
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
        <Setter Property="Padding" Value="30,18,30,12"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:AeroWizardPage}">
                    <Border x:Name="PART_OuterBorder" 
                            BorderBrush="{TemplateBinding BorderBrush}"
                            Background="{TemplateBinding Background}">
                        <Border BorderThickness="{TemplateBinding BorderThickness}"  
                                BorderBrush="{TemplateBinding BorderBrush}">
                            <DockPanel Margin="{TemplateBinding Padding}">
                                <TextBlock DockPanel.Dock="Top" VerticalAlignment="Center" Width="Auto" 
                                           Height="Auto" FontWeight="Bold" 
                                           Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Header}"/>
                                <ContentPresenter Margin="0,15,0,0" RecognizesAccessKey="True" 
                                                  SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
                                                  ContentSource="Content" 
                                                  ContentTemplate="{TemplateBinding ContentTemplate}"
                                                  ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"/>
                            </DockPanel>
                        </Border>
                    </Border>
                    <ControlTemplate.Triggers>
                        <!-- If we do not have a border thickness applied then do an outer one visible during transitions -->
                        <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=BorderThickness}" Value="0">
                            <Setter TargetName="PART_OuterBorder" Property="BorderThickness" Value="1"/>
                            <Setter TargetName="PART_OuterBorder" Property="Margin" Value="-1"/>
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>